$(document).ready(function() { //$("input[name='captcha[input]']").attr('class', 'form-control'); $('#password').on("cut copy paste",function(e) { e.preventDefault(); }); $("#refresh_captcha").click(function(){ $.ajax({ url: "/refresh_captcha", dataType: "json", success: function(captcha){ $("input[name='captcha[id]']").attr('value', captcha.id); $('#login_frm img').attr('src', captcha.src); $("input[name='captcha[input]']").val(''); }, }); //end of ajax }); }); function pwd_hash(){ var password = $("#password").val(); if(password != ''){ var token = $("#token").val(); passwd = hex_md5(password); hpasswd = hex_md5(token + passwd); $("#password").val(hpasswd); } }